﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace MazeMarauder
{
    class StateMachine
    {
        private Dictionary<States, State> states = new Dictionary<States, State>();
        public State this[States index]
        {
            get
            {
                return states[index];
            }
            set
            {
                states[index] = value;
            }
        }
        private States currentState;
        public States CurrentState
        {
            get
            {
                return currentState;
            }
            set
            {
                if (value != currentState)
                {
                    currentState = value;
                    this[CurrentState].Start();
                }
            }
        }
        public void Update(GameTime gameTime)
        {
            this[CurrentState].Update(gameTime);
        }
        public void Draw(GameTime gameTime)
        {
            this[CurrentState].Draw(gameTime);
        }
        public StateMachine()
        {

        }
    }
}
